import VueRouter from 'vue-router'
import {routes} from "@/router/routes";


const router = new VueRouter({
    routes,
    scrollBehavior (to, from, savedPosition) {
        return { x: 0, y: 0 }
    }

})

// 重写push和replace方法
let originPush = VueRouter.prototype.push;

VueRouter.prototype.push = function (location, resolve, refject) {
    if (resolve && refject) {
        originPush.call(this, location, resolve, refject)
    } else {
        originPush.call(this, location, () => {
        }, () => {
        })
    }
}

export default router